package leetcode.code789.EscapeTheGhosts;

public class Solution78901 extends EscapeTheGhosts {

	@Override
	public boolean escapeGhosts(int[][] ghosts, int[] target) {
		int[] start = new int[] { 0, 0 };
		int me = len(start, target);
		for (int[] ghost : ghosts) {
			if(len(ghost, target)<=me) {
				return false;
			}
		}
		return true;
	}

	public int len(int[] start, int[] target) {
		int lenx = target[0] - start[0] > 0 ? target[0] - start[0] : start[0] - target[0];
		int leny = target[1] - start[1] > 0 ? target[1] - start[1] : start[1] - target[1];
		return lenx + leny;
	}

	public static void main(String[] args) {
		Solution78901 so = new Solution78901();
		so.debug1();
		so.debug2();
	}

}
